using System;
using System.IO;
using System.Runtime.Serialization.Json;
public static class JsonHelper
{
	public static string ToJson(object obj)
	{
		DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(obj.GetType());
		Stream stream = new MemoryStream();
		dataContractJsonSerializer.WriteObject(stream, obj);
		stream.Position = 0L;
		StreamReader streamReader = new StreamReader(stream);
		string result = streamReader.ReadToEnd();
		streamReader.Close();
		return result;
	}
}
